home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: Using a Base constructor for a derived class
- Date: 16 Jan 1996 09:31:59 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4dfraf$8vr@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe9.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 15, 1996 11:15:05 in article <Using a Base constructor for a derived
- class>, 'culbreth@cc.gatech.edu (Matthew W. Culbreth)' wrote:
-
-
- >Howdy,
- >
- >I have a base class with a constructor. This class is never used
- >in my application. I have three classes derived from this class.
- >
- >When I create an instant of one of the derived class, I want to use the
- >constructor from the base class. The compiler is stating that it can't
- find
- >the constructor for the arguments passed for any of the derived classes.
- >Are constructors inherited the same as member functions?
-
- Base class constructors must be called explicitly:
-
- Deriv::Deriv(int a, float b, const char * c)
- : Base(a), Otherbase(c, a), localvar(b)
- {
- ... Deriv-specific code.
- }
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-